
var createdSign = function (params) {

    var keys = Object.keys(params).sort();
    var waitSign = '';
    keys.forEach(function(i){
        if(params[i] && i != 'sign'){
            waitSign += _utf_encode(String(params[i]));
        }
    });

    if(!waitSign){
        callback(-2,"核验字段错误");
        return;
    }

    return $.md5(waitSign);
};

/**
 * utf编码字符串
 * @param string
 * @returns {string}
 * @private
 */
function _utf_encode(string){
    string = string.replace(/rn/g,"n");
    var utftext ="";
    for (var n = 0; n < string.length; n++){
        var c = string.charCodeAt(n);
        if (c < 128){
            utftext += String.fromCharCode(c);
        }
        else if((c > 127) && (c < 2048)){
            utftext += String.fromCharCode((c >> 6) | 192);
            utftext += String.fromCharCode((c & 63) | 128);
        }
        else{
            utftext += String.fromCharCode((c >> 12) | 224);
            utftext += String.fromCharCode(((c >> 6) & 63) | 128);
            utftext += String.fromCharCode((c & 63) | 128);
        }
    }
    return utftext;
}